package com.rainbow.bam.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

import com.rainbow.bam.interceptor.SiteHandlerInterceptor;
import com.rainbow.bam.properties.ServiceProperties;

/**
 * 系统拦截器配置
 * 
 * @author HarrisonHan
 * @version $Id: ApplicationIntecepter.java, v 0.1 2015年6月29日 下午4:37:32 HarrisonHan Exp $
 */
@Configuration
public class ApplicationIntercepter extends WebMvcAutoConfigurationAdapter {

    /**
     * 资源properties
     */
    @Autowired
    private ServiceProperties serviceProperties;

    /** 
     * 配置拦截器 
     */
    public void addInterceptors(InterceptorRegistry registry) {
        SiteHandlerInterceptor siteHandlerInterceptor = new SiteHandlerInterceptor();
        siteHandlerInterceptor.setServiceProperties(serviceProperties);
        registry.addInterceptor(siteHandlerInterceptor).addPathPatterns("/**");
    }

}
